PROP_WINDOW,
PROP_CLIP,
+ PROP_PAINT_CONTEXT,
N_PROPS
};
G_OBJECT_TYPE_NAME (gobject));
return;
}
- priv->paint_context = priv->window->gl_paint_context;
- if (priv->paint_context)
- g_object_ref (priv->paint_context);
+
+ case PROP_PAINT_CONTEXT:
+ priv->paint_context = g_value_dup_object (value);
break;
case PROP_CLIP:
g_value_set_boxed (value, priv->clip);
break;
+ case PROP_PAINT_CONTEXT:
+ g_value_set_object (value, priv->paint_context);
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
}
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS);
+ /**
+ * GdkDrawingContext:paint-context:
+ *
+ * The #GdkGLContext used to draw or %NULL if Cairo is used.
+ *
+ * Since: 3.90
+ */
+ obj_property[PROP_PAINT_CONTEXT] =
+ g_param_spec_object ("paint-context", "Paint context", "The context used to draw",
+ GDK_TYPE_GL_CONTEXT,
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS);
g_object_class_install_properties (gobject_class, N_PROPS, obj_property);
}
return priv->window;
}
+/**
+ * gdk_drawing_context_get_paint_context:
+ * @context: a #GdkDrawingContext
+ *
+ * Retrieves the paint context used to draw with.
+ *
+ * Returns: (transfer none): a #GdkGLContext or %NULL
+ *
+ * Since: 3.90
+ */
+GdkGLContext *
+gdk_drawing_context_get_paint_context (GdkDrawingContext *context)
+{
+ GdkDrawingContextPrivate *priv = gdk_drawing_context_get_instance_private (context);
+
+ g_return_val_if_fail (GDK_IS_DRAWING_CONTEXT (context), NULL);
+
+ return priv->paint_context;
+}
+
/**
* gdk_drawing_context_get_clip:
* @context: a #GdkDrawingContext
GDK_AVAILABLE_IN_3_22
GdkWindow * gdk_drawing_context_get_window (GdkDrawingContext *context);
+GDK_AVAILABLE_IN_3_90
+GdkGLContext* gdk_drawing_context_get_paint_context (GdkDrawingContext *context);
GDK_AVAILABLE_IN_3_22
cairo_region_t *gdk_drawing_context_get_clip (GdkDrawingContext *context);
/**
* gdk_window_begin_draw_frame:
* @window: a #GdkWindow
+ * @context: (allow-none): the context used to draw the frame
* @region: a Cairo region
*
* Indicates that you are beginning the process of redrawing @region
*/
GdkDrawingContext *
gdk_window_begin_draw_frame (GdkWindow *window,
+ GdkGLContext *gl_context,
const cairo_region_t *region)
{
GdkDrawingContext *context;
g_return_val_if_fail (GDK_IS_WINDOW (window), NULL);
g_return_val_if_fail (gdk_window_has_native (window), NULL);
g_return_val_if_fail (gdk_window_is_toplevel (window), NULL);
+ if (gl_context != NULL)
+ {
+ g_return_val_if_fail (GDK_IS_GL_CONTEXT (gl_context), NULL);
+ g_return_val_if_fail (gdk_gl_context_get_window (gl_context) == window, NULL);
+ }
if (window->drawing_context != NULL)
{
context = g_object_new (GDK_TYPE_DRAWING_CONTEXT,
"window", window,
+ "paint-context", gl_context,
"clip", region,
NULL);
void gdk_window_mark_paint_from_clip (GdkWindow *window,
cairo_t *cr);
-GDK_AVAILABLE_IN_3_22
+GDK_AVAILABLE_IN_3_90
GdkDrawingContext *gdk_window_begin_draw_frame (GdkWindow *window,
+ GdkGLContext *context,
const cairo_region_t *region);
GDK_AVAILABLE_IN_3_22
void gdk_window_end_draw_frame (GdkWindow *window,
gtk_inspector_record_render (widget, renderer, window, region, root);
- context = gdk_window_begin_draw_frame (window, region);
+ context = gdk_window_begin_draw_frame (window, NULL, region);
gsk_renderer_render (renderer, root, context);
gsk_render_node_unref (root);